package com.fancy.ui.imple
{
	import com.fancy.framework.BundleModuleName;
	import com.fancy.framework.BundleNotice;
	import com.fancy.net.notice.NetNoticeType;
	import com.fancy.net.stream.login.LoginReq;
	import com.fancy.ui.UIActivator;
	import com.fancy.ui.ctrls.ease.EsButton;
	import com.fancy.ui.ctrls.ease.EsLabel;
	import com.fancy.ui.gate.DisplayGate;
	
	import flash.events.MouseEvent;

	public class LoginManage extends ManageBase
	{
		private var title:EsLabel = new EsLabel("LoginManage");
		private var cmdBtn:EsButton = new EsButton(60, 23);
		
		public function LoginManage()
		{
			super();
		}
		
		override public function initialize():void
		{
			title.caption = "连接尚未建立";
			title.x = 0;
			title.y = 0;
			DisplayGate.AlertLayer.addChild(title);
			cmdBtn.x = 0;
			cmdBtn.y = 100;
			DisplayGate.AlertLayer.addChild(cmdBtn);
			cmdBtn.addEventListener(MouseEvent.CLICK, cmdBtn_click);
		}
		
		private function cmdBtn_click(event:MouseEvent):void
		{
			var notice:BundleNotice = new BundleNotice();
			notice.type = NetNoticeType.SEND_TO_SRV;
			notice.name = LoginReq.MSG_ID;
			notice.module = BundleModuleName.NET_CONNECTION;
			var vo:Object = {};
			notice.body = {account:"vip86", pwd:"72a"};
			UIActivator.leader.send(notice);
		}
		
		public function handleConnect(type:int):void
		{
			switch(type)
			{
			case 0:
				title.caption = "跨域成功";
				break;
			case 1:
				title.caption = "连接建立成功";
				break;
			case 2:
				title.caption = "Socket连接失败";
				break;
			case 3:
				title.caption = "Socket连接断开";
				break;
			}
		}
		
	}
}